package com.android.huimeiqupin.adapt;

import android.widget.ImageView;

import com.android.huimeiqupin.model.member.OrderListData;
import com.android.huimeiqupin.R;
import com.android.huimeiqupin.utils.ObjectUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2016/8/10.
 */
public class listMineOrderAdapt extends BaseQuickAdapter<OrderListData.MineOrderdata.MineOrderlistdata, BaseViewHolder> {

    public listMineOrderAdapt(int layoutResId, List<OrderListData.MineOrderdata.MineOrderlistdata> data) {
        super(layoutResId, data);

    }


    @Override
    protected void convert(BaseViewHolder holder, OrderListData.MineOrderdata.MineOrderlistdata mineChoujiangdata) {
        holder.setText(R.id.item_list_mine_dingdang_title, mineChoujiangdata.getName());
        holder.setText(R.id.shuliang, "数量：" + mineChoujiangdata.getBuy_num());
        holder.setText(R.id.item_list_mine_dingdang_zhuangtai, mineChoujiangdata.getStatus_name());
        holder.setText(R.id.item_list_mine_dingdang_totalmoney, "￥" + mineChoujiangdata.getOrder_amount());
        ObjectUtils.photo(mContext, mineChoujiangdata.getThumb(), (ImageView) holder.getView(R.id.item_list_mine_dingdang_img));

        switch (mineChoujiangdata.getStatus_id()) {
            case 100:
                //待付款
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);

                break;
            case 101:
                //待发货
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                break;
            case 102:
                //待收货
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                break;
            case 110:
                //待评价

                if (mineChoujiangdata.getIs_rate() == 0) {
                    holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, true);
                    holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                } else {
                    holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, true);
                    holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                    holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                }
                if (mineChoujiangdata.getRefund() == 1) {
                    holder.setVisible(R.id.daipinjia_wuliu, true);
                } else {
                    holder.setVisible(R.id.daipinjia_wuliu, false);
                }

                break;
            case 111:
                //已取消
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, true);
                break;
            case 112:
                //退款中
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                break;
            case 113:
                //退款成功
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                break;
            default:
                holder.setVisible(R.id.item_list_mine_dingdang_daifukuang_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daifahuo_ll, true);
                holder.setVisible(R.id.item_list_mine_dingdang_daishouhuo_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_daipinjia_ll, false);
                holder.setVisible(R.id.item_list_mine_dingdang_cancel_ll, false);
                break;

        }


        holder.addOnClickListener(R.id.daipinjia_pinjia);
        holder.addOnClickListener(R.id.daipinjia_wuliu);
        holder.addOnClickListener(R.id.daishouhuo_daifahuo_detail);
        holder.addOnClickListener(R.id.daishouhuo_daifahuo_lianximaijia);
        holder.addOnClickListener(R.id.daishouhuo_wuliu);

        holder.addOnClickListener(R.id.daishouhuo_queren);
        holder.addOnClickListener(R.id.daifukuang_pay);
        holder.addOnClickListener(R.id.daifukuang_canceldingdang);
        holder.addOnClickListener(R.id.item_list_mine_dingdang_lottery_result);
        holder.addOnClickListener(R.id.daipinjia_detele);


    }


}


